//
//  ZJInfoUpdateViewController.m
//  GongXinDangJian
//
//  Created by ZJ on 2017/12/8.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "ZJInfoUpdateViewController.h"
#import "ZJRBTextFliedView.h"
#import "LPCostomLabelAndTextFieldAndImageView.h"
#import "ZJSIScopeView.h"
#import "ZJPhoneTextFliedView.h"
#import "LPCostomChooseYearAndMonthAndDayDateView.h"
#import "ZJDistrictSeleView.h"
#import "CManager.h"
#import "YBNormalTreeTableView.h"
#import "YBNormalTreeModel.h"
#import "ZJMZSeleViwe.h"
@interface ZJInfoUpdateViewController ()<ZJSIScopeViewDelegate,LPCostomLabelAndTextFieldAndImageViewDelegate,LPCostomChooseYearAndMonthAndDayDelegate,ZJDistrictSeleViewDelegate , YBNormalTreeTableViewDelegate , ZJMZSeleViweDelegate>{
    NSArray *_addressArray;/**< 地区的数组 */
    UIView *_seleView;/**< 记录选中的view */
    NSString *_sixString;/**< 性别 */
    NSString *_crewTypeString;/**< 人员类别 */
    NSString *_partyTypeString;/**< 党籍状态 */
    NSString *_disappointedString;/**< 是否为失联党员 */
    NSString *_streamString;/**< 是否为流动党员 */
}
/** scrollView */
@property (nonatomic, strong) UIScrollView *scrollView;
/** 姓名 */
@property (nonatomic, strong) ZJRBTextFliedView *name;
/** 性别*/
@property (nonatomic, strong) ZJSIScopeView *six;
/**  民族  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *nationality;
/** 身份证 */
@property (nonatomic, strong) ZJRBTextFliedView *card;
/**  出生日期  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *birthDay;
/**  学历代码  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *degreeCode;
/** 人员类别 */
@property (nonatomic, strong) ZJSIScopeView *crewType;
/** 所在党支部 */
@property (nonatomic, strong) ZJRBTextFliedView *partyBranch;
/**  加入党组织日期  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *joinTime;
/**  转为正式党员日期  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *exchangeTime;
/**  工作岗位  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *job;
/** 手机号 */
@property (nonatomic, strong) ZJRBTextFliedView *phoneNumber;
/** 座机号 */
@property (nonatomic, strong) ZJPhoneTextFliedView *phoneTextFliedView;
/** 家庭住址（具体到门牌号） */
@property (nonatomic, strong) ZJRBTextFliedView *address;
/** 党籍状态*/
@property (nonatomic, strong) ZJSIScopeView *partyType;
/** 是否为失联党员 */
@property (nonatomic, strong) ZJSIScopeView *disappointed;
/**  失去联系日期  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *disappointedTime;
/** 是否为流动党员（由流出地党组织负责采集） */
@property (nonatomic, strong) ZJSIScopeView *stream;
/**  外出流向  */
@property (strong, nonatomic)  LPCostomLabelAndTextFieldAndImageView *goOutStream;
/** 提交修改信息申请 */
@property (nonatomic, strong) UIButton *apply;

/** 年月日选择器 */
@property (nonatomic, strong) LPCostomChooseYearAndMonthAndDayDateView *timeSelectView;
/** 地区选择器 */
@property (nonatomic, strong) ZJDistrictSeleView *districtSeleView;

@property (nonatomic , strong) NSMutableArray *  educationArray;

@property (nonatomic , strong) NSMutableArray * workArray;

@property (nonatomic , strong) YBNormalTreeTableView * educationSelectView;

@property (nonatomic , strong) YBNormalTreeTableView * workSelectView;

@property (nonatomic , strong) YBNormalTreeModel * currentEducationModel;

@property (nonatomic , strong) YBNormalTreeModel * currentJobModel;
/** 民族选择器 */
@property (nonatomic, strong) ZJMZSeleViwe *mzSeleViwe;
@end

@implementation ZJInfoUpdateViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.currentEducationModel = nil;
    self.currentJobModel = nil;
    _sixString = @"1";
    _streamString = @"0";
    _disappointedString = @"1";
    _crewTypeString = @"1";
    _partyTypeString = @"1";
    self.titlelabel.text = @"信息更新";
    [self setupUI];
    [self initData];
}

- (void)initData{
    NSArray * educationCodeArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"EducationCode" ofType:@"plist"]];
    self.educationArray = [[NSArray yy_modelArrayWithClass:[YBNormalTreeModel class] json:educationCodeArray] mutableCopy];
    [self.educationSelectView reloadViewDataWithArray:self.educationArray];
    
    NSArray * workCodeArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"WorkJob" ofType:@"plist"]];
    self.workArray = [[NSArray yy_modelArrayWithClass:[YBNormalTreeModel class] json:workCodeArray] mutableCopy];
    [self.workSelectView reloadViewDataWithArray:self.workArray];
    
    
    
}

- (void)setupUI{
    [self.view addSubview:self.scrollView];
    [self.scrollView addSubview:self.name];
    [self.scrollView addSubview:self.six];
    [self.scrollView addSubview:self.nationality];
    [self.scrollView addSubview:self.card];
    [self.scrollView addSubview:self.birthDay];
    [self.scrollView addSubview:self.degreeCode];
    [self.scrollView addSubview:self.crewType];
    [self.scrollView addSubview:self.partyBranch];
    [self.scrollView addSubview:self.joinTime];
    [self.scrollView addSubview:self.exchangeTime];
    [self.scrollView addSubview:self.job];
    [self.scrollView addSubview:self.phoneNumber];
    [self.scrollView addSubview:self.phoneTextFliedView];
    [self.scrollView addSubview:self.address];
    [self.scrollView addSubview:self.partyType];
    [self.scrollView addSubview:self.disappointed];
    [self.scrollView addSubview:self.disappointedTime];
    [self.scrollView addSubview:self.stream];
    [self.scrollView addSubview:self.goOutStream];
    [self.scrollView addSubview:self.apply];
    
    self.scrollView.contentSize = CGSizeMake(self.view.width, self.apply.bottom + 28 * [UIScreen zj_screenHScale]);
    [self.view addSubview:self.educationSelectView];
    [self.view addSubview:self.workSelectView];
    
}

#pragma mark - ZJSIScopeViewDelegate 协议方法
- (void)ZJSIScopeViewClick_scopeView:(ZJSIScopeView *)scopeView index:(NSInteger)index{
    _seleView = scopeView;
    if (scopeView == self.six) {
        if (index == 0) {
            _sixString = @"1";
        }else{
            _sixString = @"0";
        }
    }else if (scopeView == self.crewType) {
        if (index == 0) {
            _crewTypeString = @"1";
        }else{
            _crewTypeString = @"0";
        }
    }else if (scopeView == self.partyType) {
        if (index == 0) {
            _partyTypeString = @"1";
        }else{
            _partyTypeString = @"0";
        }
    }else if (scopeView == self.disappointed) {
        if (index == 0) {
            _disappointedString = @"1";
        }else{
            _disappointedString = @"0";
        }
    }else if (scopeView == self.stream) {
        if (index == 0) {
            _disappointedString = @"1";
        }else{
            _disappointedString = @"0";
        }
    }
}
#pragma mark - LPCostomLabelAndTextFieldAndImageViewDelegate 协议方法
- (void)LPCostomLabelAndTextFieldAndImageWith:(LPCostomLabelAndTextFieldAndImageView *)view click:(BOOL)click{
    _seleView = view;
    if (view == self.nationality) {
        [self.mzSeleViwe show];
    }else if (view == self.birthDay){
        [self.timeSelectView show:[NSDateFormatter stringWithDate:[NSDate date]]];
    }else if (view == self.degreeCode){
        
        [self adjustTreeViewLocationWithTreeView:self.educationSelectView currentView:self.degreeCode];
        
    }else if (view == self.joinTime){
        [self.timeSelectView show:[NSDateFormatter stringWithDate:[NSDate date]]];

    }else if (view == self.exchangeTime){
        [self.timeSelectView show:[NSDateFormatter stringWithDate:[NSDate date]]];

    }else if (view == self.job){
        
        [self adjustTreeViewLocationWithTreeView:self.workSelectView currentView:self.job];
        
    }else if (view == self.disappointedTime){
        [self.timeSelectView show:[NSDateFormatter stringWithDate:[NSDate date]]];
    }else if (view == self.goOutStream){
        [self.districtSeleView show];
    }
}

-(void)adjustTreeViewLocationWithTreeView:(YBNormalTreeTableView *)treeView currentView:(UIView *)currentView{
    [self.view endEditing:YES];
    treeView.contentView.center = CGPointMake([UIScreen zj_screenWith] / 2, [UIScreen zj_screenHeight] * 0.75);
    [self.scrollView setContentOffset:self.scrollView.contentOffset];
    CGFloat tempViewHeight = CGRectGetMaxY(currentView.frame) - ItemHeight * 10;
    CGFloat tempHeight = tempViewHeight - self.scrollView.contentOffset.y;
    if (tempHeight > [UIScreen zj_screenHeight] / 2) {
        CGFloat viewHeight = CGRectGetMaxY(currentView.frame) - ItemHeight * 10;
        CGFloat offsetHeight = [UIScreen zj_screenHeight] / 2 - ([UIScreen zj_screenHeight] - navHeight - viewHeight);
        [self.scrollView setContentOffset:CGPointMake(0, offsetHeight) animated:YES];
    }
    else{
        CGRect absoluteRect = [currentView convertRect:currentView.bounds toView:[UIApplication sharedApplication].keyWindow];
        CGFloat theHeight = CGRectGetMaxY(absoluteRect) - ItemHeight * 10 + [UIScreen zj_screenHeight] / 4;
        treeView.contentView.center = CGPointMake([UIScreen zj_screenWith] / 2, theHeight);
    }
    treeView.hidden = NO;
}


-(void)treeView:(YBNormalTreeTableView *)treeView didSelectCellWithModel:(YBNormalTreeModel *)model
{
    if ([treeView isEqual:self.educationSelectView]) {
        self.currentEducationModel = model;
        self.degreeCode.secondTextField.text = model.name;
    }
    else{
        self.currentJobModel = model;
        self.job.secondTextField.text = model.name;
    }
    treeView.hidden = YES;
}



#pragma mark - ZJDistrictSeleViewDelegate(地区选择) 协议方法
- (void)ZJDistrictSeleViewDelegate_String:(NSString *)string{
    self.goOutStream.secondTextField.text = string;
}
#pragma mark - LPCostomChooseYearAndMonthAndDayDelegate(时间选择) 协议方法
- (void)ChooseYearAndMonthAndDayWithTitle:(NSString *)string{
    if (_seleView == self.birthDay) {
        self.birthDay.secondTextField.text = string;
    }else if (_seleView == self.joinTime) {
        self.joinTime.secondTextField.text = string;
    }else if (_seleView == self.exchangeTime) {
        self.exchangeTime.secondTextField.text = string;
    }else if (_seleView == self.disappointedTime) {
        self.disappointedTime.secondTextField.text = string;
    }
}

#pragma mark - ZJMZSeleViweDelegate 协议方法
- (void)ZJMZSeleViweDelegate_String:(NSString *)string{
    self.nationality.secondTextField.text = string;
}
#pragma mark - 修改信息点击
- (void)action_apply{
    if (self.name.textField.text.length == 0) {
        [YJProgressHUD showMessage:@"请输入姓名" inView:self.view afterDelayTime:2];
    }else if (self.nationality.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择民族" inView:self.view afterDelayTime:2];
    }else if (self.card.textField.text.length == 0){
        [YJProgressHUD showMessage:@"请输入身份证" inView:self.view afterDelayTime:2];
    }else if (self.birthDay.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择出生日期" inView:self.view afterDelayTime:2];
    }else if (self.degreeCode.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择学历代码" inView:self.view afterDelayTime:2];
    }else if (self.partyBranch.textField.text.length == 0){
        [YJProgressHUD showMessage:@"请输入所在党支部" inView:self.view afterDelayTime:2];
    }else if (self.joinTime.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择加入党组织日期" inView:self.view afterDelayTime:2];
    }else if (self.exchangeTime.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择转为正式党员日期" inView:self.view afterDelayTime:2];
    }else if (self.job.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择工作岗位" inView:self.view afterDelayTime:2];
    }else if (![CManager zj_validateMobile:self.phoneNumber.textField.text]){
        [YJProgressHUD showMessage:@"请输入正确的手机号" inView:self.view afterDelayTime:2];
    }else if (self.phoneTextFliedView.textField.text.length == 0 || self.phoneTextFliedView.textField1.text.length == 0 ){
        [YJProgressHUD showMessage:@"请输入座机号" inView:self.view afterDelayTime:2];
    }else if (self.address.textField.text.length == 0){
        [YJProgressHUD showMessage:@"请输入家庭地址" inView:self.view afterDelayTime:2];
    }else if (self.disappointedTime.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择失去联系日期" inView:self.view afterDelayTime:2];
    }else if (self.goOutStream.secondTextField.text.length == 0){
        [YJProgressHUD showMessage:@"请选择外出流向" inView:self.view afterDelayTime:2];
    }else{
        [self updateUserInfo];
    }
}

- (void)updateUserInfo{
    NSDictionary *dict = @{@"ACCOUNT_ID":ZJUSERINFORMODEL.ORG_ACCOUNT.ID,
                           @"NAME":self.name.textField.text,
                           @"SEX":_sixString,
                           @"VOLK":self.nationality.secondTextField.text,
                           @"ID_CARD":self.card.textField.text,
                           @"BIRTHDAY":self.birthDay.secondTextField.text,
                           @"EDUCATION":self.degreeCode.secondTextField.text,
                           @"EDUCODE":self.currentEducationModel.ID,
                           @"PARTY_TYPE":_crewTypeString,
                           @"OWNER_UNIT":@"",
                           @"JOINPARTYDATE":self.joinTime.secondTextField.text,
                           @"FORMALDATE":self.exchangeTime.secondTextField.text,
                           @"JOB":self.job.secondTextField.text,
                           @"JOB_CODE":self.currentJobModel.ID,
                           @"PHONE":self.phoneNumber.textField.text,
                           @"TEL":[NSString stringWithFormat:@"%@%@",self.phoneTextFliedView.textField.text,self.phoneTextFliedView.textField1.text],
                           @"ADDRESS":self.address.textField.text,
                           @"PARTYSTATE":_partyTypeString,
                           @"ISLOSE":_disappointedString,
                        @"LOSEDATE":self.disappointedTime.secondTextField.text,
                           @"ISUNFIXED":_streamString,
                           @"DIRECTION":self.goOutStream.secondTextField.text
                           };
    [YJProgressHUD show:@"更新中..." inView:self.view mode:YJProgressModeLoading];
    __weak typeof(self) weakSelf = self;
    [YBRequestManager request_updateUserInfo_dict:dict successBlock:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {
            [YJProgressHUD showMessage:@"更新成功" inView:weakSelf.view];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [[ToolClass getMainNavigationController] popViewControllerAnimated:YES];
            });
        }else{
            [YJProgressHUD showMessage:@"更新失败" inView:weakSelf.view];
        }
    } failBlock:^(id object) {
        [YJProgressHUD showMessage:@"更新失败" inView:weakSelf.view];
    }];
}

#pragma mark - Setter


#pragma mark - Getters
- (UIScrollView *)scrollView{
    if (_scrollView == nil){
        _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, navHeight, self.view.width, self.view.height - navHeight)];
        _scrollView.contentOffset = CGPointZero;
        _scrollView.contentSize = _scrollView.size;
        _scrollView.bounces = NO;
    }
    return _scrollView;
}
- (ZJRBTextFliedView *)name{
    if (_name == nil){
        _name = [[ZJRBTextFliedView alloc] initWithFrame:CGRectMake(0, 0 , self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"姓名"];
        _name.maxNumber = 50;
        _name.titleLabel.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _name.titleLabel.y, self.view.width - 24 * [UIScreen zj_screenWScale], _name.titleLabel.height);
        _name.textField.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _name.textField.y, self.view.width - 24 * [UIScreen zj_screenWScale], _name.textField.height);
        _name.textField.placeholder = @"";
    }
    return _name;
}


- (ZJSIScopeView *)six{
    if (_six == nil){
        _six = [[ZJSIScopeView alloc]initWithFrame:CGRectMake(0, self.name.bottom, self.view.width, 195  * [UIScreen zj_screenHScale]) title:@"性别"];
        [_six minUpdataUI_dataArray:@[@"男",@"女"] selectString:@"0"];
        _six.titleLabel.font = LYPFONT(16);
        _six.delegate = self;
    }
    return _six;
}
- (LPCostomLabelAndTextFieldAndImageView *)nationality{
    if (!_nationality) {
        _nationality = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.six.bottom, self.view.width, 80 * [UIScreen zj_screenHScale]) title:@"民族" placehold:@"" imageString:@"sign_select_more"];
        _nationality.isShow = YES;
        _nationality.delegate = self;
    }
    return _nationality;
}

- (ZJRBTextFliedView *)card{
    if (_card == nil){
        _card = [[ZJRBTextFliedView alloc] initWithFrame:CGRectMake(0, self.nationality.bottom , self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"公民身份证号"];
        _card.maxNumber = 18;
        _card.isNumber = YES;
        _card.titleLabel.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _card.titleLabel.y, self.view.width - 24 * [UIScreen zj_screenWScale], _card.titleLabel.height);
        _card.textField.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _card.textField.y, self.view.width - 24 * [UIScreen zj_screenWScale], _card.textField.height);
        _card.textField.placeholder = @"";

    }
    return _card;
}

- (LPCostomLabelAndTextFieldAndImageView *)birthDay{
    if (!_birthDay) {
        _birthDay = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.card.bottom, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"出生日期" placehold:@"" imageString:@"footmark_add_calendar"];
        _birthDay.isShow = YES;
        _birthDay.delegate = self;
    }
    return _birthDay;
}
- (LPCostomLabelAndTextFieldAndImageView *)degreeCode{
    if (!_degreeCode) {
        _degreeCode = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.birthDay.bottom, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"学历代码" placehold:@"" imageString:@"sign_select_more"];
        _degreeCode.isShow = YES;
        _degreeCode.delegate = self;
    }
    return _degreeCode;
}

- (ZJSIScopeView *)crewType{
    if (_crewType == nil){
        _crewType = [[ZJSIScopeView alloc]initWithFrame:CGRectMake(0, self.degreeCode.bottom, self.view.width, 195  * [UIScreen zj_screenHScale]) title:@"人员类别"];
        [_crewType minUpdataUI_dataArray:@[@"正式党员",@"预备党员"] selectString:@"0"];
        _crewType.titleLabel.font = LYPFONT(16);
        _crewType.delegate = self;
    }
    return _crewType;
}

- (ZJRBTextFliedView *)partyBranch{
    if (_partyBranch == nil){
        _partyBranch = [[ZJRBTextFliedView alloc] initWithFrame:CGRectMake(0, self.crewType.bottom , self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"所在党支部"];
        _partyBranch.maxNumber = 50;
        _partyBranch.titleLabel.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _partyBranch.titleLabel.y, self.view.width - 24 * [UIScreen zj_screenWScale], _partyBranch.titleLabel.height);
        _partyBranch.textField.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _partyBranch.textField.y, self.view.width - 24 * [UIScreen zj_screenWScale], _partyBranch.textField.height);
        _partyBranch.textField.placeholder = @"";

    }
    return _partyBranch;
}

- (LPCostomLabelAndTextFieldAndImageView *)joinTime{
    if (!_joinTime) {
        _joinTime = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.partyBranch.bottom, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"加入党组织日期" placehold:@"" imageString:@"footmark_add_calendar"];
        _joinTime.isShow = NO;
        _joinTime.delegate = self;
    }
    return _joinTime;
}

- (LPCostomLabelAndTextFieldAndImageView *)exchangeTime{
    if (!_exchangeTime) {
        _exchangeTime = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.joinTime.bottom, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"转为正式党员日期" placehold:@"" imageString:@"footmark_add_calendar"];
        _exchangeTime.isShow = NO;
        _exchangeTime.delegate = self;
    }
    return _exchangeTime;
}
- (LPCostomLabelAndTextFieldAndImageView *)job{
    if (!_job) {
        _job = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.exchangeTime.bottom, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"工作岗位" placehold:@"" imageString:@"sign_select_more"];
        _job.isShow = NO;
        _job.delegate = self;
    }
    return _job;
}
- (ZJRBTextFliedView *)phoneNumber{
    if (_phoneNumber == nil){
        _phoneNumber = [[ZJRBTextFliedView alloc] initWithFrame:CGRectMake(0, self.job.bottom , self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"手机号"];
        _phoneNumber.maxNumber = 11;
        _phoneNumber.isNumber = YES;
        _phoneNumber.titleLabel.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _phoneNumber.titleLabel.y, self.view.width - 24 * [UIScreen zj_screenWScale], _phoneNumber.titleLabel.height);
        _phoneNumber.textField.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _phoneNumber.textField.y, self.view.width - 24 * [UIScreen zj_screenWScale], _phoneNumber.textField.height);
        _phoneNumber.textField.placeholder = @"";

    }
    return _phoneNumber;
}

- (ZJPhoneTextFliedView *)phoneTextFliedView{
    if (_phoneTextFliedView == nil){
        _phoneTextFliedView = [[ZJPhoneTextFliedView alloc] initWithFrame:CGRectMake(0, self.phoneNumber.bottom,self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"固定电话"];
        _phoneTextFliedView.textField.placeholder = @"";
        _phoneTextFliedView.textField1.placeholder = @"";
    }
    return _phoneTextFliedView;
}

- (ZJRBTextFliedView *)address{
    if (_address == nil){
        _address = [[ZJRBTextFliedView alloc] initWithFrame:CGRectMake(0, self.phoneTextFliedView.bottom , self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"家庭住址（具体到门牌号）"];
        _address.maxNumber = 11;
        _address.isNumber = NO;
        _address.titleLabel.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _address.titleLabel.y, self.view.width - 24 * [UIScreen zj_screenWScale], _address.titleLabel.height);
        _address.textField.frame = CGRectMake(12 * [UIScreen zj_screenWScale], _address.textField.y, self.view.width - 24 * [UIScreen zj_screenWScale], _address.textField.height);
        _address.textField.placeholder = @"";

    }
    return _address;
}


- (ZJSIScopeView *)partyType{
    if (_partyType == nil){
        _partyType = [[ZJSIScopeView alloc]initWithFrame:CGRectMake(0, self.address.bottom, self.view.width, 195  * [UIScreen zj_screenHScale]) title:@"党籍状态"];
        [_partyType minUpdataUI_dataArray:@[@"正常",@"停止党籍"] selectString:@"0"];
        _partyType.titleLabel.font = LYPFONT(16);
        _partyType.delegate = self;
    }
    return _partyType;
}

- (ZJSIScopeView *)disappointed{
    if (_disappointed == nil){
        _disappointed = [[ZJSIScopeView alloc]initWithFrame:CGRectMake(0, self.partyType.bottom, self.view.width, 195  * [UIScreen zj_screenHScale]) title:@"是否为失联党员"];
        [_disappointed minUpdataUI_dataArray:@[@"是",@"否"] selectString:@"0"];
        _disappointed.titleLabel.font = LYPFONT(16);
        _disappointed.delegate = self;
    }
    return _disappointed;
}
- (LPCostomLabelAndTextFieldAndImageView *)disappointedTime{
    if (!_disappointedTime) {
        _disappointedTime = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.disappointed.bottom, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"失去联系日期" placehold:@"" imageString:@"footmark_add_calendar"];
        _disappointedTime.isShow = NO;
        _disappointedTime.delegate = self;
    }
    return _disappointedTime;
}
- (ZJSIScopeView *)stream{
    if (_stream == nil){
        _stream = [[ZJSIScopeView alloc]initWithFrame:CGRectMake(0, self.disappointedTime.bottom, self.view.width, 195  * [UIScreen zj_screenHScale]) title:@"是否为流动党员（由流出地党组织负责采集）"];
        [_stream minUpdataUI_dataArray:@[@"是",@"否"] selectString:@"1"];
        _stream.titleLabel.font = LYPFONT(16);
        _stream.delegate = self;
    }
    return _stream;
}

- (LPCostomLabelAndTextFieldAndImageView *)goOutStream{
    if (!_goOutStream) {
        _goOutStream = [[LPCostomLabelAndTextFieldAndImageView alloc] initWithFrame:CGRectMake(0, self.stream.bottom, self.view.width, 90 * [UIScreen zj_screenHScale]) title:@"外出流向" placehold:@"" imageString:@"sign_select_more"];
        _goOutStream.secondTextField.text = @"省（市、区）";
        _goOutStream.isShow = NO;
        _goOutStream.delegate = self;
    }
    return _goOutStream;
}

- (UIButton *)apply{
    if (_apply == nil){
        _apply = [[UIButton alloc] initWithFrame:CGRectMake(40 * [UIScreen zj_screenWScale], self.goOutStream.bottom + 28 * [UIScreen zj_screenHScale], self.scrollView.width - 80 * [UIScreen zj_screenWScale], 44 * [UIScreen zj_screenHScale])];
        _apply.backgroundColor = [UIColor themeColor];
        [_apply setTitle:@"提交修改信息申请" forState:UIControlStateNormal];
        [_apply setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _apply.layer.cornerRadius = 5 * [UIScreen zj_screenHScale];
        [_apply addTarget:self action:@selector(action_apply) forControlEvents:UIControlEventTouchUpInside];
    }
    return _apply;
}

- (LPCostomChooseYearAndMonthAndDayDateView *)timeSelectView{
    if (_timeSelectView == nil){
        _timeSelectView = [[LPCostomChooseYearAndMonthAndDayDateView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
        _timeSelectView.delegate = self;
    }
    return _timeSelectView;
}
- (ZJDistrictSeleView *)districtSeleView{
    if (_districtSeleView == nil){
        _districtSeleView = [[ZJDistrictSeleView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
        _districtSeleView.delegate = self;
        
    }
    return _districtSeleView;
}


-(NSMutableArray *)educationArray
{
    if (!_educationArray) {
        _educationArray = [NSMutableArray array];
    }
    return _educationArray;
}

-(NSMutableArray *)workArray
{
    if (!_workArray) {
        _workArray = [NSMutableArray array];
    }
    return _workArray;
}

-(YBNormalTreeTableView *)educationSelectView
{
    if (!_educationSelectView) {
        _educationSelectView = [[YBNormalTreeTableView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], [UIScreen zj_screenHeight])];
        _educationSelectView.hidden = YES;
        _educationSelectView.delegate = self;
    }
    return _educationSelectView;
}


-(YBNormalTreeTableView *)workSelectView
{
    if (!_workSelectView) {
        _workSelectView = [[YBNormalTreeTableView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], [UIScreen zj_screenHeight])];
        _workSelectView.hidden = YES;
        _workSelectView.delegate = self;
    }
    return _workSelectView;
}





- (ZJMZSeleViwe *)mzSeleViwe{
    if (_mzSeleViwe == nil){
        _mzSeleViwe = [[ZJMZSeleViwe alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
        _mzSeleViwe.delegate = self;
    }
    return _mzSeleViwe;
}

@end
